package com.dongwu.config;

import com.dongwu.common.constants.TencentIMConstants;
import com.dongwu.common.utils.Digests;

/**
 * 
 * 腾讯云通信拼接Url方法
 * 
 * @author xyj
 *
 */
public class IMSpliceUrl {
	/**
	 * 
	 * 拼接云通信完整url
	 * 
	 * @param serverUrl
	 * @param sdkappid
	 * @param username
	 * @return
	 */
	public static String Url(String serverUrl,String sig) {
		String Url = "https://console.tim.qq.com/";
		// 云通信服务器导入账号路径
		Url += serverUrl;
		// 参数
		Url += "?sdkappid=" + TencentIMConstants.SDKAPPID;
		Url += "&identifier=" + TencentIMConstants.ACCOUNT_IDENTIFIER;
		try {
			Url += "&usersig=" + sig;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Url += "&random=" + Digests.getMD5("" + System.currentTimeMillis());
		Url += "&contenttype=json";
		Url += "&apn=1";

		return Url;

	}
}
